"""
author: Jackson Black
time: 2023-08-20 13-11-01 
"""


# 类的定义
class Student(object):  # (object) 表示继承object
    # 构造器  其中任意方法的第一个参数必须是本身，约定self表示
    # 属性一般以单下划线开头，约定俗成（区分属性）
    def __init__(self, _name, _age, _gender):
        self._name = _name
        self._age = _age
        self._gender = _gender

    # 普通方法
    def speak(self):
        print(f'My name is {self._name}, a {self._age} years old boy.')

    # 权限问题：以两个下划线开头的，为私有；其他为公开
    # AttributeError: 'Student' object has no attribute '__run'
    def __run(self):
        print("私有方法")


def test_student(name, age, gender):
    student = Student(name, age, gender)
    print(student)
    student.speak()


if __name__ == "__main__":
    test_student("Jason", 21, "male")


